<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/aja','AjaxController@get');
Route::get('/aja/get','AjaxController@doget');
Route::post('/aja/post','AjaxController@dopost');


	// 获取验证码
	Route::get('/capch/{tmp}','admin\LoginController@capch');
	Route::get('/admin/login','admin\LoginController@index');
	Route::post('/admin/login','admin\LoginController@dologin');
	// 后台群组
Route::group(['prefix'=>'admin','middleware' => 'checkUser'],function(){
	Route::get('/logout','admin\LoginController@logout');
	Route::get('/','admin\IndexController@index');

	Route::resource('/link','admin\LinkController');
	Route::resource('/config','admin\ConfigController');
	Route::get('/logo','admin\LogoController@index');
	Route::post('/logo','admin\LogoController@doUpload');
	Route::post('/pic','admin\PicController@doUpload');
	Route::post('/bigpic','admin\BigpicController@doUpload');

	Route::resource("/list","admin\ListController");
	Route::resource("/Ulist","admin\UlistController");
	Route::resource("/comt","admin\ComtController");
	Route::resource("order/order","admin\OrderController");

	Route::resource('/type','admin\TypeController');
	Route::get('/typeSon/{id}','admin\TypeController@createSon');
	Route::post('/typeSon','admin\TypeController@storeSon');

	Route::resource('/goods','admin\GoodsController');
});

	// 前台群组
Route::group(['prefix'=>'home'],function(){
	Route::get('/','home\IndexController@index');
    // 用户注册
	Route::resource('/zhuce','home\ZhuceController');
	Route::get('/capch/{tmp}','home\ZhuceController@capch');
    // 商品分类
	Route::resource("/type","home\TypeController");
	Route::post('/aja','home\TypeController@doget');
    // 登录登出
	Route::get('/login','home\LoginController@index');
	Route::post('/login','home\LoginController@dologin');
	Route::get('/logout','home\LoginController@logout');
    // 商品详情
    Route::get('/goods/{id}','home\GoodsController@show');
});

    //前台登陆后群组
Route::group(['prefix'=>'home1','middleware' => 'checkLoad'],function(){
    // 进入前台个人空间
    Route::resource('/space','home\UserspaceController');
    Route::resource('/info','home\InfoController');
    Route::resource('/order','home\OrderController');
    Route::get('/shou/{id}','home\OrderController@update');
    Route::resource('/comm','home\CommentController');
    Route::resource('/reply','home\ReplyController');
    Route::resource("/favorites","home\FavoritesController");
    Route::resource('/address','home\EditaddController');
    Route::resource('/change','home\ChangeController');
    Route::any('/addfa/{id}','home\FavoritesController@store');
    // 点击'立即购买'生成的订单
    Route::resource('/editorder','home\EditOrderController');
    Route::any('/editorder1','home\EditOrderController@store');
    // 添加与修改订单地址
    Route::resource('/editaddress','home\AddressController');
    // 购物车
    Route::resource('/cart','home\CartController');
    Route::any('/cartt','home\CartController@update');
    Route::any('/deleteall','home\CartController@deleteall');
    //购物车转订单
    Route::resource('/corder','home\CorderController');
    Route::any('/corder1','home\CorderController@store');
    Route::post('/corder2','home\CorderController@update');
    Route::resource('/comment','home\GoodsController');
    Route::post('/pay','home\PayController@update');
});
